package com.yzc.tour;

import com.yzc.pojo.Pve;
import com.yzc.pojo.Tour;
import com.yzc.pve.PveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/tour")
public class TourController {

    @Autowired
    private TourService tourService;
    @Autowired
    private PveService pveService;

    public TourController(TourService tourService) {
        this.tourService = tourService;
    }

    @PostMapping("/tourloadAll.do")
    public List<Tour> loadAll(){
        return tourService.loadAll();
    }

     @PostMapping("/pveloadAll.do")
    public List<Pve> pveloadAll(){
        return pveService.pveloadAll();
    }

    @PostMapping("/selectInfos.do")
    public List<Tour> selectInfos(Tour tourname){
        return tourService.selectInfos(tourname);
    }

    @PostMapping("/selectBypvename.do")
    public List<Pve> selectBypvename(Pve pvename){
        return pveService.selectBypvename(pvename);
    }

    @PostMapping("/selectBypvenameOnaddress.do")
    public List<Pve> selectBypvenameOnaddress(){
        return pveService.selectBypvenameOnaddress();
    }

    @DeleteMapping("/deleteInfos.do")
    public Map deleteInfos(@RequestParam("tourid") int tourid){
        return tourService.deleteInfos(tourid);
    }

    @PostMapping("/saveInfos.do")
    public Map saveInfos(@RequestBody Tour tour){
     return tourService.saveInfos(tour);
    }


    @PostMapping("/updateInfos.do")
    public Map updateInfos(@RequestBody Tour tour){
        return tourService.updateInfos(tour);
    }
    @GetMapping("/getTourid.do")
    public Tour getTourid(Integer tourid){
        return tourService.getTourid(tourid);
    }



}
